package me.realirea.api.event;

import org.bukkit.block.Block;
import org.bukkit.entity.Player;
import org.bukkit.event.Cancellable;
import org.bukkit.event.HandlerList;
import org.bukkit.event.block.BlockEvent;
import org.bukkit.inventory.ItemStack;
import org.jetbrains.annotations.NotNull;

import java.util.List;

/**
 * 墓碑生成事件
 */
public class TombstoneGenerateEvent extends BlockEvent implements Cancellable {

    private static final HandlerList handlerList = new HandlerList();

    private final Player player;
    private final List<ItemStack> funeral;
    private boolean cancelled;

    /**
     * 墓碑生成事件
     *
     * @param block   方块
     * @param player  死者
     * @param funeral 陪葬品
     */
    public TombstoneGenerateEvent(@NotNull Block block, Player player, List<ItemStack> funeral) {
        super(block);
        this.player = player;
        this.funeral = funeral;
    }

    /**
     * 获取死者
     *
     * @return 死者
     */
    @NotNull
    public Player getPlayer() {
        return player;
    }

    /**
     * 获取陪葬品
     *
     * @return 陪葬品
     */
    @NotNull
    public List<ItemStack> getFuneral() {
        return funeral;
    }

    @Override
    public boolean isCancelled() {
        return cancelled;
    }

    @Override
    public void setCancelled(boolean cancelled) {
        this.cancelled = cancelled;
    }

    @NotNull
    @Override
    public HandlerList getHandlers() {
        return handlerList;
    }

    @NotNull
    public static HandlerList getHandlerList() {
        return handlerList;
    }
}
